Skip to content

MTLS Without Tokens Support#3747

Open
tlupes wants to merge 10 commits intoAzureAD:masterfrom
tlupes:mTLS
Open

MTLS Without Tokens Support#3747
tlupes wants to merge 10 commits intoAzureAD:masterfrom
tlupes:mTLS

Conversation

@tlupes
Copy link
Contributor

@tlupes tlupes commented Mar 11, 2026

NOTE
This is blocked on AzureAD/microsoft-identity-abstractions-for-dotnet#244

Support for mTLS authentication only mode for DownstreamApi

Adds support for mTLS only mode for DownstreamApi. This allows you to configure a protocol of "MTLS" and the configured certificate will be attached to the request without and authentication header.

This is set up to work with all existing certificate infrastructure as Token Acquisition. This means that the Managed Certificate logic will fit right in.

Description

This essentially does the following:

  • Refactors all the certificate handling logic (including the observers) into a reusable "CredentialProvider"
  • Modifies TokenAquesition to use this CredentialProvider
  • Configures DownstreamApi to use this CredentialProvider as well.
    • If Protocol is MTLS, tokens are skipped
    • If Protocol is MTLS, it takes the first certificate credential and adds it as a certificate.
    • If Protocol is MTLS, the result of the call is checked right there to see if it's a certificate error. If so, it retries once.

@tlupes tlupes marked this pull request as ready for review March 17, 2026 20:54
@tlupes tlupes requested a review from a team as a code owner March 17, 2026 20:54
Copy link
Contributor

@cpp11nullptr cpp11nullptr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add sample app (see tests/DevApps/MtlsPop as an example) which shows a developer experience?

LogMessages.AttemptToLoadCredentialsFailed(_logger, credential, ex);
errorMessage += $"Credential {credential.Id} failed because: {ex} \n";
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: extra space

namespace Microsoft.Identity.Web
{
internal partial class ConfidentialClientApplicationBuilderExtension
internal partial class CredentialsProvider
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this renamed?

private readonly IOptionsMonitor<DownstreamApiOptions> _namedDownstreamApiOptions;

private const string Authorization = "Authorization";
private const string MtlsProtocolScheme = "MTLS";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is MTLS scheme different than MTLS POP below?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants